//--------------------------------------------------------------------------
// 
//  Copyright (c) Chili Software.  All rights reserved. 
// 
//  File: IDynamicExtensible.cs
//
//  Description: Persistent that has a dynamic properties amount.
// 
//--------------------------------------------------------------------------

using System;
using System.Collections.Generic;

namespace Chili.Opf3
{
	/// <summary>
	/// This interface is implemented by classes that want be dynamically extensible.
	/// </summary>
	/// <remarks>
	/// A class that should be dynamically extensible (the class contains some fixed 
	/// key fields and a lot different other fields) has to implement this interface. All
	/// fields that are not directly mapped in that class are stored to the property
	/// exposed by this interface.
	/// </remarks>
	/// <example>
	///     The following example shows how to implement the interface. 
	///     <code lang="CS">
	/// [Persistent("USER")]
	/// public class User : IDynamicExtensible
	/// {
	///     private IDictionary&lt;string, object&gt; _unknownFields = 
	///         new Dictionary&lt;string, object&gt;();
	/// 
	///     public IDictionary&lt;string, object&gt; UnknownFields
	///     {
	///         get
	///         {
	///	           return _unknownFields;
	///         }
	///     }
	///  
	///     // ... Other properties of the persistent object.
	/// }
	///     </code>
	/// </example>
	public interface IDynamicExtensible
	{
		/// <summary>
		/// Exposes a dictionary that is filled with the fields that are not explicity 
		/// modelled in the persistent class.
		/// </summary>
		IDictionary<string, object> UnknownFields { get; }
	}
}
